<template>
  <div class="user">
    <page-search
      :searchFormConfig="audiComplaintSearch"
      @resetBtnClick="handleResetClick"
      @queryBtnClick="handleQueryClick"
      @downloadBtnClick="downloadClick"
    />
    <page-content
      ref="pageContentRef"
      :contentTableConfig="audiComplaintContent"
      pageName="audiComplaint"
      @newBtnClick="handleNewData"
      @editBtnClick="handleEditData"
    ></page-content>
    <page-modal
      :defaultInfo="defaultInfo"
      ref="pageModalRef"
      pageName="audiComplaint"
      :modalConfig="modalConfigRef"
    ></page-modal>
  </div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'
import { useStore } from '@/store'

import PageSearch from '@/components/page-search'
import PageModal from '@/components/audiComplaintpage-modal'
import PageContent from '@/components/page-content'

import { audiComplaintSearch } from './config/audiComplaintSearch.config'
import { audiComplaintContent } from './config/audiComplaintContent.config'
import { audiComplaintmodalConfig } from './config/audiComplaintmodal.config'

import { audiComplaintusePageSearch } from '@/hooks/audiComplaintuse-page-search'
import { usePageModal } from '@/hooks/use-page-modal'

export default defineComponent({
  name: 'audicomplaint',
  components: {
    PageSearch,
    PageContent,
    PageModal
  },
  setup() {
    const [pageContentRef, handleResetClick, handleQueryClick, downloadClick]
      = audiComplaintusePageSearch()

    // 获取对应的更改
    const modalConfigRef = computed(() => {
      return audiComplaintmodalConfig
    })

    // 3.调用hook获取公共变量和函数
    const [pageModalRef, defaultInfo, handleNewData, handleEditData] = usePageModal()

    return {
      audiComplaintSearch,
      audiComplaintContent,
      pageContentRef,
      handleResetClick,
      handleQueryClick,
      downloadClick,
      modalConfigRef,
      handleNewData,
      handleEditData,
      pageModalRef,
      defaultInfo
    }
  }
})
</script>

<style scoped></style>
